#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
//https://www.luogu.com.cn/problem/P10495


using namespace std;


typedef long long LL;

const int N = 1e6 + 10;

int cnt, p[N];
bool st[N];
int n;

int c[N];

void get_prime()
{
	for (int i = 2; i <= n; ++i)
	{
		if (!st[i])p[++cnt] = i;
		for (int j = 1; 1ll * p[j] * i <= n; ++j)
		{
			st[p[j] * i] = true;
			if (i % p[j] == 0)break;
		}
	}
}


int main()
{
	cin >> n;

	get_prime();

	//for (int i = 1; i <= cnt; ++i)
	//{
	//	cout << p[i] << ' ';
	//}cout << endl;

	for (int i = 1; i <= cnt; ++i)
	{
		int x = n;
		for (LL j = p[i]; j <= n; j *= p[i])
		{
			c[i] += x / j;
		}
	}

	for (int i = 1; i <= cnt; ++i)
	{
		if(c[i])
		cout << p[i] << ' ' << c[i] << endl;
	}

	return 0;
}
